package picturetaker.domain;

import java.sql.Date;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.Calendar;

import picturetaker.utility.ApplicationConstants;

public class Picture implements ApplicationConstants {

	private Long id = null;

	private String name = null;
	
	private String path = null;

	private byte[] thumbnail = null;

	private Camera camera = null;

	private Date date = null;

	private Timestamp time = null;

	private PicData picData = null;

	public Picture(String name, Camera camera, PicData picData) {
		this.camera = camera;
		this.picData = picData;
		java.util.Date date = Calendar.getInstance(DEFAULT_LOCALE).getTime();
		this.name = name
				+ UNDERSCORE
				+ DateFormat.getDateTimeInstance(DateFormat.SHORT,
						DateFormat.SHORT, DEFAULT_LOCALE).format(date)
						.replaceAll(BLANK, UNDERSCORE);
		this.date = new Date(date.getTime());
		this.time = new Timestamp(date.getTime());

	};

	public Camera getCamera() {
		return camera;
	}

	public void setCamera(Camera camera) {
		this.camera = camera;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public PicData getPicData() {
		return picData;
	}

	public void setPicData(PicData picData) {
		this.picData = picData;
	}

	public byte[] getThumbnail() {
		return thumbnail;
	}

	public void setThumbnail(byte[] thumbnail) {
		this.thumbnail = thumbnail;
	}

	public Timestamp getTime() {
		return time;
	}

	public void setTime(Timestamp time) {
		this.time = time;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}
}
